﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Hive.Core.Common.Shell;

namespace Hive.Core.Model
{
    /// <summary>
    /// A source repository is an abstraction of a source control system that
    /// enables projects to be checked out.
    /// </summary>
    public interface ISourceRepository
    {
        /// <summary>
        /// Gets the configuration of the source repository.
        /// </summary>
        SourceRepositoryConfiguration Configuration { get; }

        /// <summary>
        /// Gets the default branch name of the source repository.  eg. "trunk"
        /// </summary>
        string DefaultBranchName { get; }

        /// <summary>
        /// Checks out or updates the source of a package into in a destination directory.
        /// </summary>
        /// <param name="packageName">The package name.</param>
        /// <param name="branchName">The branch name.</param>
        /// <param name="destinationDirectory">The destination directory.</param>
        /// <param name="shell">The command shell.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="packageName"/>,
        /// <paramref name="branchName"/>, <paramref name="destinationDirectory"/>
        /// or <paramref name="shell"/> is null.</exception>
        /// <exception cref="SourceRepositoryException">Thrown if the operation failed.</exception>
        void CheckoutOrUpdate(string packageName, string branchName, DirectoryInfo destinationDirectory, IShell shell);
    }
}
